﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using System.IO.IsolatedStorage;

namespace DbSharp.Utils.IO
{
    public class PathHelper
    {
        [Obsolete("this function is not workable after packed by .NETZ ")]
        private static String GetAssemblyPath()
        {
            string location=Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            return location + Path.DirectorySeparatorChar;
        }


                
        public static String GetAppPath()
        {
            string location = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
            return location + Path.DirectorySeparatorChar;
        }

        [Obsolete("this function is not workable in unit testing project")]
        public static String GetAppPath2()
        {
            string location = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            return location + Path.DirectorySeparatorChar;
        }

        [Obsolete]
        public static String GetAppFileFullName()
        {
            return Assembly.GetEntryAssembly().Location;
        }

        [Obsolete]
        public static string GetApplicationNameWithoutExt()
        {
            string str = Assembly.GetEntryAssembly().Location;
            str= Path.GetFileNameWithoutExtension(str);
            return str;
        }

        [Obsolete]
        public static string GetAppFileNameWithoutPath()
        {
            return Path.GetFileName(GetAppFileFullName());
        }

        [Obsolete]
        public static String GetLocalAppDataPath()
        {
            string applicationName = GetApplicationNameWithoutExt();
            string str = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            str = Path.Combine(str, applicationName);
            return str + Path.DirectorySeparatorChar;
        }

    }
}
